<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});
//Route::get('admin/login', 'Admin\IndexController@login');
//Route::get('admin/index', 'Admin\IndexController@index');
//
Route::group(['prefix' => 'admin','namespace'=>'Admin','middleware'=>['admin.login']], function () {
    Route::get('index', 'IndexController@index');
    Route::get('info', 'IndexController@info');
    Route::get('loginout', 'LoginController@loginout');
    Route::any('pass', 'IndexController@pass');
    Route::post('cate/changeorder', 'CategoryController@changeOrder');
    Route::resource('category', 'CategoryController');
    Route::resource('article', 'ArticleController');
    Route::resource('link', 'LinkController');
    Route::post('link/changeorder', 'LinkController@changeOrder');
    Route::resource('navs', 'NavsController');
    Route::post('navs/changeorder', 'NavsController@changeOrder');
    //网站配置
    Route::resource('config', 'ConfigController');
    Route::post('config/changeorder', 'ConfigController@changeOrder');
    Route::get('createConfig', 'ConfigController@createConfig');
    Route::any('upload', 'CommonController@upload');
});
Route::group(['prefix' => 'admin','namespace'=>'Admin'], function () {
    Route::any('login', 'LoginController@index');
    Route::any('crypt', 'LoginController@crypt');
    Route::get('code', 'LoginController@code');

    Route::get('getcode', 'LoginController@getcode');
});

Route::group(['namespace'=>'Home'], function () {
    Route::any('/', 'IndexController@index');
    Route::any('artList', 'IndexController@artList');
    Route::any('article', 'IndexController@article');
});
//
//Route::group(['middleware' => 'auth'], function () {
//    Route::get('/', function () {
//        // 使用 Auth 中间件
//    });
//
//    Route::get('user/profile', function () {
//        // 使用 Auth 中间件
//    });
//});


//Route::get('user/profile', [
//    'as' => 'profile', 'uses' => 'UserController@index'
//]);
//Route::get('cui/profile', 'UserController@index')->name('profile');
//Route::get('cui', ['as' => 'profile', function () {
//    echo route('profile');
//    echo '<h1>命名路由</h1>';
//}]);
//Route::get('test', function () {
//    return view('welcome');
//});
//Route::get('/jjj', function () {
////    return view('welcome');
//    echo'4444';
//});
//
//Route::get('user/{id}', function ($id) {
//    return 'User '.$id;
//})->where('id', '[0-9]+');;
//Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
////    return 'User '.$postId.'comments '.$commentId;
//    return $commentId;
//});
//Route::get('user/{name?}', function ($name =0) {
//    return $name;
//});